home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1992-1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- //////////////////////////////////////////////////////////////////////
- // Driver.h - definition of the driver class
- //
- // The driver initiates events and views output from the
- // simulator.
- //
- // This class is what changes if the interface to the
- // outside world changes (i.e. mouse-based workstation simulation
- // becomes full-fledged car device. Yeah, right. Dream on, pal.)
- //////////////////////////////////////////////////////////////////////
-
- #ifndef DRIVER_H
- #define DRIVER_H
-
- #include "Defines.h"
- #include "Window.h"
- #include "Display.h"
-
- class Car;
- class Cockpit;
- class Road;
- class sample;
- class Timer;
-
- // Top of the cockpit in a window of height 1.0
- const float COCKPIT_TOP = (6.5/20.0);
-
- class Driver {
-
- public:
-
- Driver(Car *);
- ~Driver();
-
- void update(Boolean ok_to_sleep);
- Boolean done() const { return _done; };
-
- float get_fps() const { return _fps; };
- float get_max_fps() const { return _max_fps; };
- long last_frame_time() const { return _last_frame_time; };
-
- const Cockpit * get_cockpit() const { return _cockpit; };
-
- void crash() { _crashed = TRUE; _crash_handled = FALSE; };
-
- Timer * get_timer() const { return _timer; };
-
- Boolean helping() const { return _helping; };
-
- SbVec2s getViewWindowSize() const
- { return SbVec2s((short)_view_win.sizex, (short)_view_win.sizey); }
-
- protected:
-
- void open();
- void draw();
- void draw_view();
- void timed_draw(Boolean include_in_average);
- void draw_flags();
- void draw_cars(Boolean draw_self);
- void event(long, short);
- void set_view();
- void init_devices();
- void reset_all();
- void reshape_subwindow(long wid);
- void reset_helicopter();
- void handle_crash();
- void draw_crash();
-
- // window relative, -1.0 to 1.0
- float _mouse_x;
-
- // car that this driver is in
- Car * _car;
-
- // cockpit that this driver is looking at
- // only car's with local drivers need a cockpit
- // robots don't, networked cars don't
- Cockpit * _cockpit;
-
- // information about the windows
- Window _parent_win, _cockpit_win, _view_win;
-
- // Do the viewports need to be redrawn ?
- // a redraw_cockpit implies a redraw_view
- Boolean _redraw_cockpit, _redraw_view;
-
- float _fps, _max_fps; // frames per second
- long _last_frame_time; // in microseconds
-
- Boolean _done; // are we outta here?
-
- Display _display; // How we see the world
-
- // circular list of car positions used to orient helicopter
- SbMatrix * _helio_orientation;
- SbVec3f * _helio_position;
- SbVec3f _helio_offset;
- int _helio_use_index;
- int _helio_fill_index;
- int _helio_lag; // number of frames behind car
-
- Boolean _cranking; // is the ignition being held
-
- // keyboard repeat params saved away
- short _old_keywarp[2]; // threshold and repeat rate
-
- // lap timing
- Timer * _timer;
- Boolean _first_timing;
-
- // stuff for the crash
- Boolean _crashed, _crash_handled;
- Boolean _broken_winshield;
- sample * _crash_noise;
-
- Boolean _helping; // TRUE if displaying help screen
- };
-
- #endif
-
-